import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router/index'
import './plugins/iview.js'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

Vue.config.productionTip = false
// Vue.prototype.$Modal = modal

// Vue.use(modal)
router.beforeEach((to, from, next) => {
  const token = localStorage.getItem("token")
  if (to.name !== 'login') {
    if (localStorage.getItem("userInfo") == null && token == null){
       next('/login')
    }
  }
  next()
})
new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app')
